<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/11/6
 * Time: 9:58
 */

namespace app\admin\logic;

/*****  用户附件  ******/
class UserAccessory
{

    protected $model;

    public function __construct()
    {
        $this->model = new \app\admin\model\user\UserAccessory();
    }

    public function add($path)
    {
        $this->model->setAttr('path', $path);
        $this->model->save();
        return $this->model->getLastInsID();
    }

    public function isExist($where = [])
    {
        return $this->model->where($where)->find();

    }

    public function getPath($id)
    {

        $b = $this->model->where('accessory_id', $id)->find();
        if ($b) {
            return $b->getAttr('path');
        } else {
            return '';
        }
    }


}